const express = require('express');
const morgan = require('morgan');
const routes = require('./routes');
const errorHandler = require('./middlewares/errorHandler');
const { port } = require('./config/config');

const app = express();

app.use(morgan('dev'));
app.use(express.json());
app.use('/', routes);
app.use(errorHandler);

app.listen(port, () => {
  console.log(`Server is running on http://localhost:${port}`);
});